/*
package com.css.zfzx.sjcj.common.spacedata;

import com.css.bpm.platform.base.response.RestResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

*/
/**
 * @Description
 * @Author zyc
 * @Date 2021/1/13 15:32
 * @Version V1.0
 *//*

@RestController
@RequestMapping("/hddc/hddcShpDataMapDisplay")
public class UploadSpaceFilesData {
    @Autowired
    private SpacedataAnalysis spacedataanalysis;
    //获取配置文件的上传文件路径
    @Value("${file.upload.path}")
    private String uploadPath;

    @PostMapping("/importFile")
    public RestResponse uploadSpaceData(@RequestParam("files") MultipartFile[] files,SpaceDataParamsVo paramsVo) {
        //数据校验
        if (files == null && files.length <= 0) {
            return RestResponse.fail("导入失败，请选择文件");
        }
        if(StringUtils.isEmpty(paramsVo.getType())){
            return RestResponse.fail("导入失败，传入类型不能为空");
        }

        //spacedataanalysis=new SpacedataAnalysis();

        // 返回的消息
        StringBuilder returnMsg = new StringBuilder();
        //循环处理每一个文件
        String jxfilename="";
        String dbffilename="";
        for (MultipartFile file : files) {
            //获取上传原文件名称
            String oldFileName = file.getOriginalFilename();

            // 获取上传文件的后缀
            //String fileSuffix = oldFileName.substring(oldFileName.lastIndexOf(".") + 1, oldFileName.length());
            // 上传后文件名
            String newFileName = paramsVo.getType()+ "_" + (paramsVo.getProvinceCode() == null ? "0" : paramsVo.getProvinceCode())
                    + "_" + (paramsVo.getCityCode() == null ? "0" : paramsVo.getCityCode()) + "_" + (paramsVo.getAreaCode() == null ? "0" : paramsVo.getAreaCode()) + "_" + oldFileName;
            if(newFileName.contains(".shp")){
                jxfilename=newFileName;
            }
            if(oldFileName.contains(".dbf")){
                dbffilename=newFileName;
            }

            File savefile = new File(uploadPath + newFileName);
            if (!savefile.getParentFile().exists()) {
                savefile.getParentFile().mkdirs();
            }
            try {
                file.transferTo(savefile);
                returnMsg.append(newFileName);
                returnMsg.append(",");
            } catch (IOException e) {
                e.printStackTrace();
                return RestResponse.fail(newFileName + "上传失败");
            }
        }

        String[] paramdatas=VectorDataUtil.getFieldName(uploadPath + dbffilename, "GBK");
        if(paramdatas!=null&&paramdatas.length>0){
            String str = spacedataanalysis.judgeFileParams(paramdatas,paramsVo.getType());
            if(str!=""&&str!=null&&str.length()>0){
                return RestResponse.fail("导入数据参数不正确，参数必须包含【"+str+"】");
            }
        }else{
            return RestResponse.fail("导入的dbf文件参数不能为空。");
        }


        String resultMsg = returnMsg.substring(0, returnMsg.length() - 1);
        List<List<Object>> list = VectorDataUtil.readSHPFile(uploadPath + jxfilename);
        spacedataanalysis.saveFileDatas(list,paramsVo);
        return RestResponse.succeed(resultMsg + "上传成功");
    }
}
*/
